package test;

import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

@MessageDriven(mappedName = "jms/queue/deposito", activationConfig = {
		@ActivationConfigProperty(propertyName = "clientId", propertyValue = "portaltestClientID"),
		@ActivationConfigProperty(propertyName = "destination", propertyValue = "jms/queue/deposito"),
		@ActivationConfigProperty(propertyName = "user", propertyValue = "deposito"),
		@ActivationConfigProperty(propertyName = "password", propertyValue = "deposito123"),
		@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
		@ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge") })
public class PortalListener implements MessageListener {

	@Override
	public void onMessage(Message message) {
		if (message instanceof TextMessage) {
			try {
				System.out.println(((TextMessage)message).getText());
			} catch (JMSException e) {
				e.printStackTrace();
			}
		}
	}

}
